using ZFramework;

namespace PaintAWorld.Gd
{
    public static class IntoVoxelModelExtension
    {
        public static VoxelModel ToVoxelModel(this VoxModel model)
        {
            var result = new VoxelModel(model.submodels[0].width, model.submodels[0].height, model.submodels[0].length);

            foreach (var (pos, color) in model.GetVoxels(0))
            {
                result.SetColor(model.submodels[0].width - pos.X - 1, pos.Z, pos.Y, color);
            }

            return result;
        }
    }
}